package com.example.fengyungo.dao;

import com.example.fengyungo.domain.pojo.Admin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface AdminDao {

    @Select("select * from admin where adminUsername = #{username}")
    Admin getAdminByUsernameAndPassword(String username);

    /**
     * 添加管理员
     * @param admin 管理员
     * @return Integer
     */
    @Insert("insert into admin(" +
            "adminId, adminNickname, adminUsername, adminSex, adminPhone, adminPassword, adminAvatar, adminStatus, adminCreateTime, adminCreatorId, adminMail" +
            ") VALUES (" +
            "#{adminId}, #{adminNickname}, #{adminUsername}, #{adminSex}, #{adminPhone}, #{adminPassword}, #{adminAvatar}, #{adminStatus}, #{adminCreateTime}, #{adminCreatorId}, #{adminMail}" +
            ")")
    Integer addAdmin(Admin admin);

    /**
     * 修改管理员
     * @param admin 管理员
     * @return Integer
     */
    Integer updateAdmin(Admin admin);
}
